import time
#import Say
import network
from machine import Pin, PWM

#p1 = Pin(0, Pin.OUT)#D3 PWM
#p1 = Pin(1, Pin.OUT)#TX
#p4 = Pin(2, Pin.OUT)#D4 LED_PIN PWM
#p1 = Pin(3, Pin.OUT)#RX
#p1 = Pin(4, Pin.OUT)#D2 PWM
#p1 = Pin(5, Pin.OUT)#D1 PWM
#p1 = Pin(12, Pin.OUT)#D6 PWM
#p1 = Pin(13, Pin.OUT)#D7 PWM
#p1 = Pin(14, Pin.OUT)#D5 PWM
p1 = Pin(15, Pin.OUT)#D8 PWM
#p1 = Pin(16, Pin.OUT)#D0 on_board_LED
pwm = PWM(p1, freq=512, duty=0)
wifi = network.WLAN(network.STA_IF)
wifi.active(True)
wifi.connect("CQHT-WX", "")
print("\n\n\n\n\n" + str(wifi.status()) + " is ok")

while True:
    # p1.on()
    # time.sleep(1)
    # p1.off()
    # time.sleep(1)
    # Say.Hello()
    for i in range(1, 1024):
        pwm.duty(i)
        time.sleep_ms(2)
    time.sleep(1)
    for i in range(1024, 1, -1):
        pwm.duty(i)
        time.sleep_ms(3)

